import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CooperationVO, CooperationForm, CooperationQuery } from '@/api/module/cooperation/types';

/**
 * 查询商务合作信息列表
 * @param query
 * @returns {*}
 */

export const listCooperation = (query?: CooperationQuery): AxiosPromise<CooperationVO[]> => {
  return request({
    url: '/module/cooperation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询商务合作信息详细
 * @param id
 */
export const getCooperation = (id: string | number): AxiosPromise<CooperationVO> => {
  return request({
    url: '/module/cooperation/' + id,
    method: 'get'
  });
};

/**
 * 新增商务合作信息
 * @param data
 */
export const addCooperation = (data: CooperationForm) => {
  return request({
    url: '/module/cooperation',
    method: 'post',
    data: data
  });
};

/**
 * 修改商务合作信息
 * @param data
 */
export const updateCooperation = (data: CooperationForm) => {
  return request({
    url: '/module/cooperation',
    method: 'put',
    data: data
  });
};

/**
 * 删除商务合作信息
 * @param id
 */
export const delCooperation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/module/cooperation/' + id,
    method: 'delete'
  });
};
